#include "graph.h"

#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_DYN_LINK

#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_tools.hpp>

#include <boost/assign/std/vector.hpp>

using namespace std;
using namespace boost::assign;

BOOST_AUTO_TEST_CASE(graph_test) {
    FullGraph gd(4 * n, 4 * n);
    BOOST_CHECK(gd.isConnected(0, NUM_VERTICES - 1));
    for(size_t i = 0; i < NUM_VERTICES; ++i) {
        const vector<size_t>& inc = gd.incendents(i);
        for(size_t j = 0; j < inc.size(); ++j) {
            BOOST_CHECK_EQUAL(distanceCalculator(elements[i],
                        elements[inc[j]]), 4 * n);
        }
    }

    for(size_t mn = 0; mn <= 4 * n; ++mn) {
        for(size_t mx = mn; mx <= min(4 * n, mn + 3); ++mx) {
           FullGraph gs(mn, mx);
           for(size_t i = 0; i < NUM_VERTICES; ++i) {
               for(size_t j = i; j < NUM_VERTICES; ++j) {
                   size_t dst = distanceCalculator(elements[i], elements[j]);
                   BOOST_CHECK_EQUAL(gs.isConnected(i, j), mn <= dst && dst <= mx);
               }
           }
        }
    }
}
